//
// Created by xili on 2024/8/3 15:49.
// Go big or go home.
//
#include <vector>
#include <unordered_set>

using namespace std;

class Solution {
public:
    vector<vector<int>> findDifference(vector<int> &nums1, vector<int> &nums2) {
        vector<vector<int>> ans;
        unordered_set<int> s1;
        unordered_set<int> s2;
        ans.resize(2);
        for (auto &item: nums1) {
            s1.emplace(item);
        }
        for (auto &item: nums2) {
            s2.emplace(item);
        }
        for (auto &item: s1) {
            if (!s2.count(item)) {
                ans[0].emplace_back(item);
            }
        }
        for (auto &item: s2) {
            if (!s1.count(item)) {
                ans[1].emplace_back(item);
            }
        }
        return ans;
    }
};